﻿#ifndef __AVOID_CONTROL_COMBOBOX_HEAD_FILE_INCLUDED__
#define __AVOID_CONTROL_COMBOBOX_HEAD_FILE_INCLUDED__
#include "control.h"
#include "ctlList.h"
#include "ctlButton.h"
#include "ctlSingleEdit.h"

namespace swui
{
#pragma warning(push)
#pragma warning(disable:4250)
	class ctlComboBox : 
		virtual public ctlRoot, public IFont
	{
	public:
		static const ctlControlType uniqueType = ctlControlType::ctlComboBox;
	public:
		~ctlComboBox() { destroy(); }
		bool create(ctlRoot* parent, ctlPoint pos, unsigned width);
	public:
		void popup();
		void popdown();
		bool isPopup();
	public:
		void setListHeight(unsigned height);
		unsigned getListHeight();
	public:
		bool insertRow(unsigned index, const ctlText& text);
		bool appendRow(const ctlText& text);
		bool removeRow(unsigned index);
		ctlSingleLabel* getRowCtrl(unsigned index);
		unsigned getSelectedRow();
		bool setSelectedRow(unsigned index);
		ctlSingleLabel* getSelectedCtrl();
	public:
		void activeSingleEdit(bool);
		bool isSingleEditActive();
		void setButtonArrowColor(ctlColor cr);
		ctlColor getButtonArrowColor();
	public:
		ctlSingleEdit* getSingleEdit();
		ctlButton* getButton();
		ctlList* getList();
	protected:
		void _redraw_(_ctlInterior::drawInfo*);
	private:
		ctlList _combobox_list;
		ctlSingleEdit _combobox_edit;
		ctlButton _combobox_button;
		ctlStatic* _combobox_mouse_stay;
		unsigned _combobox_list_height;
		ctlColor _combobox_button_arrow_color;
		unsigned _combobox_triangle_lambda;
	};
#pragma warning(pop)
}

#endif